#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    this->textToSpeech=new QTextToSpeech;
    textToSpeech->setLocale(QLocale::Chinese);
    textToSpeech->setRate(0.1);//语速
    textToSpeech->setPitch(2.2);//音高
    textToSpeech->setVolume(1.0);//音量


}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    textToSpeech->say(ui->textEdit->toPlainText());
}

void Widget::on_pushButton_2_clicked()
{
    textToSpeech->pause();
}
